#include <cfg_api.h>
#include <wla_api.h>
#include <string.h>
#include "product.h"


//TODO: update these product info

#define product_name 			"alink_product"
#define product_ver 			"1.0.8"
#define product_model           "OPENALINK_LIVING_LIGHT_SDS_TEST"
#define product_key             "1L6ueddLqnRORAQ2sGOL"
#define product_secret          "qfxCLoc1yXEk9aLdx5F74tl1pdxl0W0q7eYOvvuo"
#define product_debug_key       "dpZZEpm9eBfqzK7yVeLq"
#define product_debug_secret    "THnfRRsU5vu6g6m9X6uFyAjUWflgZ0iyGjdEneKm"



char *product_get_name(char name_str[PRODUCT_NAME_LEN])
{
	return strncpy(name_str,product_name,PRODUCT_NAME_LEN);
}

char *product_get_version(char ver_str[PRODUCT_VERSION_LEN])
{
	return strncpy(ver_str, product_ver, PRODUCT_VERSION_LEN);
}

char *product_get_model(char model_str[PRODUCT_MODEL_LEN])
{
	return strncpy(model_str,product_model,PRODUCT_MODEL_LEN);
}

char *product_get_key(char key_str[PRODUCT_KEY_LEN])
{
	return strncpy(key_str,product_key,PRODUCT_KEY_LEN);
}

char *product_get_device_key(char key_str[DEVICE_KEY_LEN])
{
	//return strncpy(key_str,device_key,DEVICE_KEY_LEN);
    return strncpy(key_str,(const char *)get_alink_device_key(),DEVICE_KEY_LEN);
}

char *product_get_device_secret(char secret_str[DEVICE_SECRET_LEN])
{
	//return strncpy(secret_str,device_secret,DEVICE_SECRET_LEN);
    return strncpy(secret_str,(const char *)get_alink_device_secret(),DEVICE_SECRET_LEN);
}

char *product_get_secret(char secret_str[PRODUCT_SECRET_LEN])
{
	return strncpy(secret_str,product_secret,PRODUCT_SECRET_LEN);
}

char *product_get_debug_key(char key_str[PRODUCT_KEY_LEN])
{
	return strncpy(key_str,product_debug_key,PRODUCT_KEY_LEN);

}

char *product_get_debug_secret(char secret_str[PRODUCT_SECRET_LEN])
{
	return strncpy(secret_str,product_debug_secret,PRODUCT_SECRET_LEN);
}

char *product_get_sn(char sn_str[PRODUCT_SN_LEN])
{
	uint8_t mac[6] = {0};
	memcpy(mac, wlan_get_myaddr(STATION),6);
	snprintf((char *)sn_str,PRODUCT_SN_LEN,"%02X%02X%02X%02X%02X%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
	return sn_str;
}


//一键配置超时时间, 建议超时时间1-3min, APP侧一键配置1min超时
int platform_awss_get_timeout_interval_ms(void)
{
    //return 3 * 60 * 1000;
    return 60*1000;
}

//默认热点配网超时时间
int platform_awss_get_connect_default_ssid_timeout_interval_ms( void )
{
    return 60*1000;
}

//一键配置每个信道停留时间, 建议200ms-400ms
int platform_awss_get_channelscan_interval_ms(void)
{
    return 300;
}

